#pragma once
// MESSAGE KF_ZK PACKING

#define MAVLINK_MSG_ID_KF_ZK 29

MAVPACKED(
typedef struct __mavlink_kf_zk_t {
 float Zk[15]; /*<  Zk*/
 float Hk[15]; /*<  Hk*/
 float Vk[15]; /*<  Vk*/
 float R[15]; /*<  R*/
}) mavlink_kf_zk_t;

#define MAVLINK_MSG_ID_KF_ZK_LEN 240
#define MAVLINK_MSG_ID_KF_ZK_MIN_LEN 240
#define MAVLINK_MSG_ID_29_LEN 240
#define MAVLINK_MSG_ID_29_MIN_LEN 240

#define MAVLINK_MSG_ID_KF_ZK_CRC 237
#define MAVLINK_MSG_ID_29_CRC 237

#define MAVLINK_MSG_KF_ZK_FIELD_ZK_LEN 15
#define MAVLINK_MSG_KF_ZK_FIELD_HK_LEN 15
#define MAVLINK_MSG_KF_ZK_FIELD_VK_LEN 15
#define MAVLINK_MSG_KF_ZK_FIELD_R_LEN 15

#if MAVLINK_COMMAND_24BIT
#define MAVLINK_MESSAGE_INFO_KF_ZK { \
    29, \
    "KF_ZK", \
    4, \
    {  { "Zk", NULL, MAVLINK_TYPE_FLOAT, 15, 0, offsetof(mavlink_kf_zk_t, Zk) }, \
         { "Hk", NULL, MAVLINK_TYPE_FLOAT, 15, 60, offsetof(mavlink_kf_zk_t, Hk) }, \
         { "Vk", NULL, MAVLINK_TYPE_FLOAT, 15, 120, offsetof(mavlink_kf_zk_t, Vk) }, \
         { "R", NULL, MAVLINK_TYPE_FLOAT, 15, 180, offsetof(mavlink_kf_zk_t, R) }, \
         } \
}
#else
#define MAVLINK_MESSAGE_INFO_KF_ZK { \
    "KF_ZK", \
    4, \
    {  { "Zk", NULL, MAVLINK_TYPE_FLOAT, 15, 0, offsetof(mavlink_kf_zk_t, Zk) }, \
         { "Hk", NULL, MAVLINK_TYPE_FLOAT, 15, 60, offsetof(mavlink_kf_zk_t, Hk) }, \
         { "Vk", NULL, MAVLINK_TYPE_FLOAT, 15, 120, offsetof(mavlink_kf_zk_t, Vk) }, \
         { "R", NULL, MAVLINK_TYPE_FLOAT, 15, 180, offsetof(mavlink_kf_zk_t, R) }, \
         } \
}
#endif

/**
 * @brief Pack a kf_zk message
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 *
 * @param Zk  Zk
 * @param Hk  Hk
 * @param Vk  Vk
 * @param R  R
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_kf_zk_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
                               const float *Zk, const float *Hk, const float *Vk, const float *R)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_KF_ZK_LEN];

    _mav_put_float_array(buf, 0, Zk, 15);
    _mav_put_float_array(buf, 60, Hk, 15);
    _mav_put_float_array(buf, 120, Vk, 15);
    _mav_put_float_array(buf, 180, R, 15);
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_KF_ZK_LEN);
#else
    mavlink_kf_zk_t packet;

    mav_array_memcpy(packet.Zk, Zk, sizeof(float)*15);
    mav_array_memcpy(packet.Hk, Hk, sizeof(float)*15);
    mav_array_memcpy(packet.Vk, Vk, sizeof(float)*15);
    mav_array_memcpy(packet.R, R, sizeof(float)*15);
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_KF_ZK_LEN);
#endif

    msg->msgid = MAVLINK_MSG_ID_KF_ZK;
    return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_KF_ZK_MIN_LEN, MAVLINK_MSG_ID_KF_ZK_LEN, MAVLINK_MSG_ID_KF_ZK_CRC);
}

/**
 * @brief Pack a kf_zk message on a channel
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param chan The MAVLink channel this message will be sent over
 * @param msg The MAVLink message to compress the data into
 * @param Zk  Zk
 * @param Hk  Hk
 * @param Vk  Vk
 * @param R  R
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_kf_zk_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
                               mavlink_message_t* msg,
                                   const float *Zk,const float *Hk,const float *Vk,const float *R)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_KF_ZK_LEN];

    _mav_put_float_array(buf, 0, Zk, 15);
    _mav_put_float_array(buf, 60, Hk, 15);
    _mav_put_float_array(buf, 120, Vk, 15);
    _mav_put_float_array(buf, 180, R, 15);
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_KF_ZK_LEN);
#else
    mavlink_kf_zk_t packet;

    mav_array_memcpy(packet.Zk, Zk, sizeof(float)*15);
    mav_array_memcpy(packet.Hk, Hk, sizeof(float)*15);
    mav_array_memcpy(packet.Vk, Vk, sizeof(float)*15);
    mav_array_memcpy(packet.R, R, sizeof(float)*15);
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_KF_ZK_LEN);
#endif

    msg->msgid = MAVLINK_MSG_ID_KF_ZK;
    return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_KF_ZK_MIN_LEN, MAVLINK_MSG_ID_KF_ZK_LEN, MAVLINK_MSG_ID_KF_ZK_CRC);
}

/**
 * @brief Encode a kf_zk struct
 *
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 * @param kf_zk C-struct to read the message contents from
 */
static inline uint16_t mavlink_msg_kf_zk_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_kf_zk_t* kf_zk)
{
    return mavlink_msg_kf_zk_pack(system_id, component_id, msg, kf_zk->Zk, kf_zk->Hk, kf_zk->Vk, kf_zk->R);
}

/**
 * @brief Encode a kf_zk struct on a channel
 *
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param chan The MAVLink channel this message will be sent over
 * @param msg The MAVLink message to compress the data into
 * @param kf_zk C-struct to read the message contents from
 */
static inline uint16_t mavlink_msg_kf_zk_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_kf_zk_t* kf_zk)
{
    return mavlink_msg_kf_zk_pack_chan(system_id, component_id, chan, msg, kf_zk->Zk, kf_zk->Hk, kf_zk->Vk, kf_zk->R);
}

/**
 * @brief Send a kf_zk message
 * @param chan MAVLink channel to send the message
 *
 * @param Zk  Zk
 * @param Hk  Hk
 * @param Vk  Vk
 * @param R  R
 */
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS

static inline void mavlink_msg_kf_zk_send(mavlink_channel_t chan, const float *Zk, const float *Hk, const float *Vk, const float *R)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_KF_ZK_LEN];

    _mav_put_float_array(buf, 0, Zk, 15);
    _mav_put_float_array(buf, 60, Hk, 15);
    _mav_put_float_array(buf, 120, Vk, 15);
    _mav_put_float_array(buf, 180, R, 15);
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_KF_ZK, buf, MAVLINK_MSG_ID_KF_ZK_MIN_LEN, MAVLINK_MSG_ID_KF_ZK_LEN, MAVLINK_MSG_ID_KF_ZK_CRC);
#else
    mavlink_kf_zk_t packet;

    mav_array_memcpy(packet.Zk, Zk, sizeof(float)*15);
    mav_array_memcpy(packet.Hk, Hk, sizeof(float)*15);
    mav_array_memcpy(packet.Vk, Vk, sizeof(float)*15);
    mav_array_memcpy(packet.R, R, sizeof(float)*15);
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_KF_ZK, (const char *)&packet, MAVLINK_MSG_ID_KF_ZK_MIN_LEN, MAVLINK_MSG_ID_KF_ZK_LEN, MAVLINK_MSG_ID_KF_ZK_CRC);
#endif
}

/**
 * @brief Send a kf_zk message
 * @param chan MAVLink channel to send the message
 * @param struct The MAVLink struct to serialize
 */
static inline void mavlink_msg_kf_zk_send_struct(mavlink_channel_t chan, const mavlink_kf_zk_t* kf_zk)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    mavlink_msg_kf_zk_send(chan, kf_zk->Zk, kf_zk->Hk, kf_zk->Vk, kf_zk->R);
#else
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_KF_ZK, (const char *)kf_zk, MAVLINK_MSG_ID_KF_ZK_MIN_LEN, MAVLINK_MSG_ID_KF_ZK_LEN, MAVLINK_MSG_ID_KF_ZK_CRC);
#endif
}

#if MAVLINK_MSG_ID_KF_ZK_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
  This varient of _send() can be used to save stack space by re-using
  memory from the receive buffer.  The caller provides a
  mavlink_message_t which is the size of a full mavlink message. This
  is usually the receive buffer for the channel, and allows a reply to an
  incoming message with minimum stack space usage.
 */
static inline void mavlink_msg_kf_zk_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan,  const float *Zk, const float *Hk, const float *Vk, const float *R)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char *buf = (char *)msgbuf;

    _mav_put_float_array(buf, 0, Zk, 15);
    _mav_put_float_array(buf, 60, Hk, 15);
    _mav_put_float_array(buf, 120, Vk, 15);
    _mav_put_float_array(buf, 180, R, 15);
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_KF_ZK, buf, MAVLINK_MSG_ID_KF_ZK_MIN_LEN, MAVLINK_MSG_ID_KF_ZK_LEN, MAVLINK_MSG_ID_KF_ZK_CRC);
#else
    mavlink_kf_zk_t *packet = (mavlink_kf_zk_t *)msgbuf;

    mav_array_memcpy(packet->Zk, Zk, sizeof(float)*15);
    mav_array_memcpy(packet->Hk, Hk, sizeof(float)*15);
    mav_array_memcpy(packet->Vk, Vk, sizeof(float)*15);
    mav_array_memcpy(packet->R, R, sizeof(float)*15);
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_KF_ZK, (const char *)packet, MAVLINK_MSG_ID_KF_ZK_MIN_LEN, MAVLINK_MSG_ID_KF_ZK_LEN, MAVLINK_MSG_ID_KF_ZK_CRC);
#endif
}
#endif

#endif

// MESSAGE KF_ZK UNPACKING


/**
 * @brief Get field Zk from kf_zk message
 *
 * @return  Zk
 */
static inline uint16_t mavlink_msg_kf_zk_get_Zk(const mavlink_message_t* msg, float *Zk)
{
    return _MAV_RETURN_float_array(msg, Zk, 15,  0);
}

/**
 * @brief Get field Hk from kf_zk message
 *
 * @return  Hk
 */
static inline uint16_t mavlink_msg_kf_zk_get_Hk(const mavlink_message_t* msg, float *Hk)
{
    return _MAV_RETURN_float_array(msg, Hk, 15,  60);
}

/**
 * @brief Get field Vk from kf_zk message
 *
 * @return  Vk
 */
static inline uint16_t mavlink_msg_kf_zk_get_Vk(const mavlink_message_t* msg, float *Vk)
{
    return _MAV_RETURN_float_array(msg, Vk, 15,  120);
}

/**
 * @brief Get field R from kf_zk message
 *
 * @return  R
 */
static inline uint16_t mavlink_msg_kf_zk_get_R(const mavlink_message_t* msg, float *R)
{
    return _MAV_RETURN_float_array(msg, R, 15,  180);
}

/**
 * @brief Decode a kf_zk message into a struct
 *
 * @param msg The message to decode
 * @param kf_zk C-struct to decode the message contents into
 */
static inline void mavlink_msg_kf_zk_decode(const mavlink_message_t* msg, mavlink_kf_zk_t* kf_zk)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    mavlink_msg_kf_zk_get_Zk(msg, kf_zk->Zk);
    mavlink_msg_kf_zk_get_Hk(msg, kf_zk->Hk);
    mavlink_msg_kf_zk_get_Vk(msg, kf_zk->Vk);
    mavlink_msg_kf_zk_get_R(msg, kf_zk->R);
#else
        uint8_t len = msg->len < MAVLINK_MSG_ID_KF_ZK_LEN? msg->len : MAVLINK_MSG_ID_KF_ZK_LEN;
        memset(kf_zk, 0, MAVLINK_MSG_ID_KF_ZK_LEN);
    memcpy(kf_zk, _MAV_PAYLOAD(msg), len);
#endif
}
